ONTRIGGER=TARGON_ITEM
//IF (<SRC.TARGET.BASEID>=iron_ingot)
//SRC.TARGET.COLOR=0
//RETURN 0
IF (<SRC.TARG.CONT.UID>==<SRC.FINDLAYER(21).UID>) // -----    --------
//------------------------------PROVERKA ARMOR LI ETO-------------------------
IF (<SRC.TARG.TYPE>=10)//is it armor?
	//SRC.SYSMESSAGE=It's armor. 
	IF (<SRC.TARG.BASEID>>=0144e) && (<SRC.TARG.BASEID><=01457) //Bone armor
		SRC.SYSMESSAGE=You can not repair bone armor
		RETURN 1
	ELSEIF (<SRC.TARG.BASEID>>=013d4) && (<SRC.TARG.BASEID><=013e2) || (<SRC.TARG.BASEID>==01c02) || (<SRC.TARG.BASEID>==01c03)  || (<SRC.TARG.BASEID>==01c0c) || (<SRC.TARG.BASEID>==01c0d)//studded leather
		SRC.SYSMESSAGE=Use sewing kit to repair studded leather armor
		RETURN 1
	ELSEIF (<SRC.TARG.BASEID>>=013c5) && (<SRC.TARG.BASEID><=013d3) || (<SRC.TARG.BASEID>==01c08) || (<SRC.TARG.BASEID>==01c09)  || (<SRC.TARG.BASEID>==01c06) || (<SRC.TARG.BASEID>==01c07)  || (<SRC.TARG.BASEID>==01c0a) || (<SRC.TARG.BASEID>==01c0b)//leather
		SRC.SYSMESSAGE=Use sewing kit to repair leather armor
		RETURN 1
	ENDIF
//------------------------------PROVERKA ARMOR LI ETO-------------------------
//------------------------------PROVERKA SKILLA-------------------------
IF (<SRC.TARG.MORE>==0)//-------------REPAIRED----------
	SRC.SYSMESSAGE=You do not need to repair <SRC.TARG.NAME>
	RETURN 1
ELSE
//SRC.SYSMESSAGE=It's not repaired
	IF (<SRC.BLACKSMITHING>>=30.0)
	//SRC.SYSMESSAGE=I got skill more than 30
		IF (<SRC.BLACKSMITHING>>=60.0)
		//SRC.SYSMESSAGE=I got skill more than 60
			IF (<SRC.BLACKSMITHING>>=80.0)
			//SRC.SYSMESSAGE=I got skill more than 80
				IF (<SRC.BLACKSMITHING>>=100.0)//---------------Grand Master or higher----------
				SRC.SYSMESSAGE=I got skill more than 100
					IF RAND(1)
						SRC.SYSMESSAGE=You was unable to repair <SRC.TARG.NAME>
						SRC.ANIM 11
						IF RAND(2)
							SOUND 0140
							IF (<SRC.TARG.HITPOINTS>>2)
								SRC.TARG.more=(<SRC.TARG.more>+ -2) // 80-100
								SRC.MESSAGE=*You damage <SRC.TARG.NAME>*
								RETURN 1
							ELSE
								SRC.MESSAGE=<SRC.TARG.NAME> has been destroyed!!!
								SRC.TARG.REMOVE
								RETURN 1
							ENDIF
						ENDIF
						RETURN 1
					ELSE
						SRC.SYSMESSAGE=You have repaired <SRC.TARG.NAME>
						SOUND 02a
						SRC.ANIM 11
						SOUND 02a
						SRC.TARG.MORE=0
						RETURN 1
					ENDIF
				ENDIF //------------------------------------------------
//----------------Blacksmithing is 80 or more, but less than 100-------------------
				IF RAND(2)
					SRC.SYSMESSAGE=You was unable to repair <SRC.TARG.NAME>
					SRC.ANIM 11
					IF RAND(2)
						SOUND 0140
						IF (<SRC.TARG.HITPOINTS>>2)
							SRC.TARG.more=(<SRC.TARG.more>+ -2) // 80-100
							SRC.MESSAGE=*You damage <SRC.TARG.NAME>*
							RETURN 1
						ELSE
							SRC.MESSAGE=<SRC.TARG.NAME> has been destroyed!!!
							SRC.TARG.REMOVE
							RETURN 1
						ENDIF
					ENDIF
					RETURN 1
				ELSE
					SRC.SYSMESSAGE=You have repaired <SRC.TARG.NAME>
					SOUND 02a
					SRC.ANIM 11
					SOUND 02a
					SRC.TARG.MORE=0
					RETURN 1
				ENDIF
			ENDIF //------------------------------
//----------------Blacksmithing is 60 or more, but less than 80-------------------			
			IF RAND(3)
				SRC.SYSMESSAGE=You was unable to repair <SRC.TARG.NAME>
				SRC.ANIM 11
				IF RAND(2)
				SOUND 0140
				IF (<SRC.TARG.HITPOINTS>>2)
					SRC.TARG.more=(<SRC.TARG.more>+ -2) // 80-100
					SRC.MESSAGE=*You damage <SRC.TARG.NAME>*
					RETURN 1
				ELSE
					SRC.MESSAGE=<SRC.TARG.NAME> has been destroyed!!!
					SRC.TARG.REMOVE
					RETURN 1
				ENDIF
				RETURN 1
			ENDIF
			ELSE
				SRC.SYSMESSAGE=You have repaired <SRC.TARG.NAME>
				SOUND 02a
				SRC.ANIM 11
				SOUND 02a
				SRC.TARG.MORE=0
				RETURN 1
			ENDIF
		ENDIF //-----------------------------------------
//----------------Blacksmithing is 30 or more, but less than 60-------------------
		IF RAND(5)
			SRC.SYSMESSAGE=You was unable to repair <SRC.TARG.NAME>
			SRC.ANIM 11
			IF RAND(2)
				SOUND 0140
				IF (<SRC.TARG.HITPOINTS>>2)
					SRC.TARG.more=(<SRC.TARG.more>+ -2) // 80-100
					SRC.MESSAGE=*You damage <SRC.TARG.NAME>*
					RETURN 1
				ELSE
					SRC.MESSAGE=<SRC.TARG.NAME> has been destroyed!!!
					SRC.TARG.REMOVE
					RETURN 1
				ENDIF
			ENDIF
			RETURN 1
		ELSE
			SRC.SYSMESSAGE=You have repaired <SRC.TARG.NAME>
			SOUND 02a
			SRC.ANIM 11
			SOUND 02a
			SRC.TARG.MORE=0
			RETURN 1
		ENDIF
	ELSE //-------------------------Blacksmithing less than 30
	//SRC.SYSMESSAGE=I got skill less than 30
		IF RAND(10)
			SRC.SYSMESSAGE=You was unable to repair <SRC.TARG.NAME>
			SRC.ANIM 11
			IF RAND(2)
				SOUND 0140
				IF (<SRC.TARG.HITPOINTS>>2)
					SRC.TARG.more=(<SRC.TARG.more>+ -2) // 80-100
					SRC.MESSAGE=*You damage <SRC.TARG.NAME>*
					RETURN 1
				ELSE
					SRC.MESSAGE=<SRC.TARG.NAME> has been destroyed!!!
					SRC.TARG.REMOVE
					RETURN 1
				ENDIF
			ENDIF
			RETURN 1
			//SAY unable to repair armor and it has not been damaged
		ELSE
			SRC.SYSMESSAGE=You have repaired <SRC.TARG.NAME>
			SOUND 02a
			SRC.ANIM 11
			SOUND 02a
			SRC.TARG.MORE=0
			RETURN 1
		ENDIF
	ENDIF 
RETURN 1
ENDIF //--------END of checking is item repaired------------
ELSE // -----------It's not armor------------------------
IF (<SRC.TARG.TYPE>==11) || (<SRC.TARG.TYPE>==12) || (<SRC.TARG.TYPE>==13) || (<SRC.TARG.TYPE>==14)//If This is weapon
//SRC.SYSMESSAGE=It's weapon
//------------------------------PROVERKA SKILLA-------------------------
IF (<SRC.TARG.MORE>==0)//-------------REPAIRED----------
	SRC.SYSMESSAGE=You do not need to repair <SRC.TARG.NAME>
	RETURN 1
ELSE
//SRC.SYSMESSAGE=It's not repaired
	IF (<SRC.BLACKSMITHING>>=30.0)
	//SRC.SYSMESSAGE=I got skill more than 30
		IF (<SRC.BLACKSMITHING>>=60.0)
		//SRC.SYSMESSAGE=I got skill more than 60
			IF (<SRC.BLACKSMITHING>>=80.0)
			//SRC.SYSMESSAGE=I got skill more than 80
				IF (<SRC.BLACKSMITHING>>=100.0)//---------------Grand Master or higher----------
				SRC.SYSMESSAGE=I got skill more than 100
					IF RAND(1)
						SRC.SYSMESSAGE=You was unable to repair <SRC.TARG.NAME> 100
						SRC.ANIM 11
						IF RAND(2)
							SOUND 0140
							IF (<SRC.TARG.HITPOINTS>>2)
								SRC.TARG.more=(<SRC.TARG.more>+ -2) // 80-100
								SRC.MESSAGE=*You damage <SRC.TARG.NAME>*
								RETURN 1
							ELSE
								SRC.MESSAGE=<SRC.TARG.NAME> has been destroyed!!!
								SRC.TARG.REMOVE
								RETURN 1
							ENDIF
						ENDIF
						RETURN 1
					ELSE
						SRC.SYSMESSAGE=You have repaired <SRC.TARG.NAME>
						SOUND 02a
						SRC.ANIM 11
						SOUND 02a
						SRC.TARG.MORE=0
						RETURN 1
					ENDIF
				ENDIF //------------------------------------------------
//----------------Blacksmithing is 80 or more, but less than 100-------------------
				IF RAND(2)
					SRC.SYSMESSAGE=You was unable to repair <SRC.TARG.NAME>
					SRC.ANIM 11
					IF RAND(2)
						SOUND 0140
						IF (<SRC.TARG.HITPOINTS>>2)
							SRC.TARG.more=(<SRC.TARG.more>+ -2) // 80-100
							SRC.MESSAGE=*You damage <SRC.TARG.NAME>*
							RETURN 1
						ELSE
							SRC.MESSAGE=<SRC.TARG.NAME> has been destroyed!!!
							SRC.TARG.REMOVE
							RETURN 1
						ENDIF
					ENDIF
					RETURN 1
				ELSE
					SRC.SYSMESSAGE=You have repaired <SRC.TARG.NAME>
					SOUND 02a
					SRC.ANIM 11
					SOUND 02a
					SRC.TARG.MORE=0
					RETURN 1
				ENDIF
			ENDIF //------------------------------
//----------------Blacksmithing is 60 or more, but less than 80-------------------			
			IF RAND(3)
				SRC.SYSMESSAGE=You was unable to repair <SRC.TARG.NAME>
				SRC.ANIM 11
				IF RAND(2)
					SOUND 0140
					IF (<SRC.TARG.HITPOINTS>>2)
						SRC.TARG.more=(<SRC.TARG.more>+ -2) // 80-100
						SRC.MESSAGE=*You damage <SRC.TARG.NAME>*
						RETURN 1
					ELSE
						SRC.MESSAGE=<SRC.TARG.NAME> has been destroyed!!!
						SRC.TARG.REMOVE
						RETURN 1
					ENDIF
				ENDIF
				RETURN 1
			ELSE
				SRC.SYSMESSAGE=You have repaired <SRC.TARG.NAME>
				SOUND 02a
				SRC.ANIM 11
				SOUND 02a
				SRC.TARG.MORE=0
				RETURN 1
			ENDIF
		ENDIF //-----------------------------------------
//----------------Blacksmithing is 30 or more, but less than 60-------------------
		IF RAND(5)
			SRC.SYSMESSAGE=You was unable to repair <SRC.TARG.NAME>
			SRC.ANIM 11
			IF RAND(2)
				SOUND 0140
				IF (<SRC.TARG.HITPOINTS>>2)
					SRC.TARG.more=(<SRC.TARG.more>+ -2) // 80-100
					SRC.MESSAGE=*You damage <SRC.TARG.NAME>*
					RETURN 1
				ELSE
					SRC.MESSAGE=<SRC.TARG.NAME> has been destroyed!!!
					SRC.TARG.REMOVE
					RETURN 1
				ENDIF
			ENDIF
			RETURN 1
		ELSE
			SRC.SYSMESSAGE=You have repaired <SRC.TARG.NAME>
			SOUND 02a
			SRC.ANIM 11
			SOUND 02a
			SRC.TARG.MORE=0
			RETURN 1
		ENDIF
	ELSE //-------------------------Blacksmithing less than 30
	//SRC.SYSMESSAGE=I got skill less than 30
		IF RAND(10)
			SRC.SYSMESSAGE=You was unable to repair <SRC.TARG.NAME>
			SRC.ANIM 11
			IF RAND(2)
				SOUND 0140
				IF (<SRC.TARG.HITPOINTS>>2)
					SRC.TARG.more=(<SRC.TARG.more>+ -2) // 80-100
					SRC.MESSAGE=*You damage <SRC.TARG.NAME>*
					RETURN 1
				ELSE
					SRC.MESSAGE=<SRC.TARG.NAME> has been destroyed!!!
					SRC.TARG.REMOVE
					RETURN 1
				ENDIF
			ENDIF
			//SAY unable to repair armor and it has not been damaged
		ELSE
			SRC.SYSMESSAGE=You have repaired <SRC.TARG.NAME>
			SOUND 02a
			SRC.ANIM 11
			SOUND 02a
			SRC.TARG.MORE=0
			RETURN 1
		ENDIF
	ENDIF 
RETURN 1
ENDIF //--------END of checking is item repaired------------
ENDIF
RETURN 0
ENDIF
ELSE //------------      --------
SRC.SYSMESSAGE=Item has to be in your backpack
RETURN 1
ENDIF